{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}

{% block breadcrumbs %}
  <li><a href="{% url 'extras:tag_list' %}">Tags</a></li>
  <li>{{ object }}</li>
{% endblock %}

{% block content %}
<div class="row">
	<div class="col-md-6">
    <div class="panel panel-default">
      <div class="panel-heading">
        <strong>Tag</strong>
      </div>
      <table class="table table-hover panel-body attr-table">
        <tr>
          <td>Name</td>
          <td>{{ object.name }}</td>
        </tr>
        <tr>
          <td>Description</td>
          <td>{{ object.description|placeholder }}</td>
        </tr>
        <tr>
          <td>Color</td>
          <td>
            <span class="label color-block" style="background-color: #{{ object.color }}">&nbsp;</span>
          </td>
        </tr>
        <tr>
          <td>Tagged Items</td>
          <td>
            {{ taggeditem_table.rows|length }}
          </td>
        </tr>
      </table>
    </div>
    {% plugin_left_page object %}
  </div>
	<div class="col-md-6">
    <div class="panel panel-default">
      <div class="panel-heading">
        <strong>Tagged Item Types</strong>
      </div>
      <table class="table table-hover panel-body">
        {% for object_type in object_types %}
          <tr>
            <td>{{ object_type.content_type.name|bettertitle }}</td>
            <td>
              {% with viewname=object_type.content_type.model_class|validated_viewname:"list" %}
                {% if viewname %}
                  <a href="{% url viewname %}?tag={{ object.slug }}">{{ object_type.item_count }}</a>
                {% else %}
                  {{ object_type.item_count }}
                {% endif %}
              {% endwith %}
            </td>
          </tr>
        {% endfor %}
      </table>
    </div>
    {% plugin_right_page object %}
	</div>
</div>
<div class="row">
	<div class="col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading">
        <strong>Tagged Items</strong>
      </div>
      {% include 'inc/table.html' with table=taggeditem_table %}
    </div>
    {% include 'inc/paginator.html' with paginator=taggeditem_table.paginator page=taggeditem_table.page %}
    {% plugin_full_width_page object %}
  </div>
</div>
{% endblock %}
